package com.cy7;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Test {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println(br);
        String m = br.readLine();
        int count = 0;
        for (int i = 2; i <= Integer.valueOf(m); i++) {
            int sum = 1;
            for (int j = 2; j <= (int)Math.sqrt(i); j++) {
                if (Math.round(i * 1.0 / j) == i * 1.0 / j) {
                    sum += j;
                    sum += i / j;
                }
            }
            if (sum == i) {
                count++;
            }
            sum = 1;
        }
        System.out.println(count);
    }
}